<!DOCTYPE html>

<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<title>class Minitest::Test - RDoc Documentation</title>

<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
</script>

<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>


<body id="top" class="class">
<nav id="metadata">
  <nav id="home-section" class="section">
  <h3 class="section-header">
    <a href="../index.html">Home</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </h3>
</nav>


  <nav id="search-section" class="section project-section" class="initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <h3 class="section-header">
      <input type="text" name="search" placeholder="Search" id="search-field"
             title="Type to search, Up and Down to navigate, Enter to load">
    </h3>
  </form>

  <ul id="search-results" class="initially-hidden"></ul>
</nav>


  <div id="file-metadata">
    <nav id="file-list-section" class="section">
  <h3 class="section-header">Defined In</h3>
  <ul>
    <li>test/test_helper.rb
  </ul>
</nav>

    
  </div>

  <div id="class-metadata">
    
    <nav id="parent-class-section" class="section">
  <h3 class="section-header">Parent</h3>
  
  <p class="link"><a href="../Object.html">Object</a>
  
</nav>

    
    <!-- Method Quickref -->
<nav id="method-list-section" class="section">
  <h3 class="section-header">Methods</h3>

  <ul class="link-list">
    
    <li><a href="#method-i-backup_system_files">#backup_system_files</a>
    
    <li><a href="#method-i-log_system_files">#log_system_files</a>
    
    <li><a href="#method-i-restore_system_files">#restore_system_files</a>
    
    <li><a href="#method-i-units_to_time">#units_to_time</a>
    
  </ul>
</nav>

  </div>

  <div id="project-metadata">
    <nav id="fileindex-section" class="section project-section">
  <h3 class="section-header">Pages</h3>

  <ul>
  
    <li class="file"><a href="../Gemfile.html">Gemfile</a>
  
    <li class="file"><a href="../README_rdoc.html">README</a>
  
    <li class="file"><a href="../Rakefile.html">Rakefile</a>
  
    <li class="file"><a href="../notes.html">notes</a>
  
    <li class="file"><a href="../syctask_rdoc.html">syctask</a>
  
  </ul>
</nav>

    <nav id="classindex-section" class="section project-section">
  <h3 class="section-header">Class and Module Index</h3>

  <ul class="link-list">
  
    <li><a href="../Syctask.html">Syctask</a>
  
    <li><a href="../Syctask/Evaluator.html">Syctask::Evaluator</a>
  
    <li><a href="../Syctask/Meeting.html">Syctask::Meeting</a>
  
    <li><a href="../Syctask/Schedule.html">Syctask::Schedule</a>
  
    <li><a href="../Syctask/Settings.html">Syctask::Settings</a>
  
    <li><a href="../Syctask/Statistics.html">Syctask::Statistics</a>
  
    <li><a href="../Syctask/Task.html">Syctask::Task</a>
  
    <li><a href="../Syctask/TaskPlanner.html">Syctask::TaskPlanner</a>
  
    <li><a href="../Syctask/TaskScheduler.html">Syctask::TaskScheduler</a>
  
    <li><a href="../Syctask/TaskService.html">Syctask::TaskService</a>
  
    <li><a href="../Syctask/TaskTracker.html">Syctask::TaskTracker</a>
  
    <li><a href="../Syctask/Times.html">Syctask::Times</a>
  
    <li><a href="../Syctask/Track.html">Syctask::Track</a>
  
    <li><a href="../Minitest.html">Minitest</a>
  
    <li><a href="../Minitest/Test.html">Minitest::Test</a>
  
    <li><a href="../Sycutil.html">Sycutil</a>
  
    <li><a href="../Sycutil/Console.html">Sycutil::Console</a>
  
    <li><a href="../ConsoleTimer.html">ConsoleTimer</a>
  
    <li><a href="../Object.html">Object</a>
  
    <li><a href="../Sycstring.html">Sycstring</a>
  
    <li><a href="../Syctime.html">Syctime</a>
  
    <li><a href="../TestDefault.html">TestDefault</a>
  
    <li><a href="../TestEnvironment.html">TestEnvironment</a>
  
    <li><a href="../TestEvaluator.html">TestEvaluator</a>
  
    <li><a href="../TestMeeting.html">TestMeeting</a>
  
    <li><a href="../TestSchedule.html">TestSchedule</a>
  
    <li><a href="../TestStatistics.html">TestStatistics</a>
  
    <li><a href="../TestTask.html">TestTask</a>
  
    <li><a href="../TestTaskPlanner.html">TestTaskPlanner</a>
  
    <li><a href="../TestTaskScheduler.html">TestTaskScheduler</a>
  
    <li><a href="../TestTaskService.html">TestTaskService</a>
  
    <li><a href="../TestTaskTracker.html">TestTaskTracker</a>
  
    <li><a href="../TestTimeUtil.html">TestTimeUtil</a>
  
    <li><a href="../TestTimes.html">TestTimes</a>
  
  </ul>
</nav>

  </div>
</nav>

<div id="documentation">
  <h1 class="class">class Minitest::Test</h1>

  <div id="description" class="description">
    
<p>Overrides Test::Unit::TestCase to add some helper methods for each test</p>

  </div><!-- description -->

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    

    <!-- Methods -->
    
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
      <h3 class="section-header">Public Instance Methods</h3>

    
      <div id="method-i-backup_system_files" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">backup_system_files</span><span
            class="method-args">(caller)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Backs up system files before manipulating them in the test</p>
          

          
          <div class="method-source-code" id="backup_system_files-source">
            <pre><span class="ruby-comment"># File test/test_helper.rb, line 17</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">backup_system_files</span>(<span class="ruby-identifier">caller</span>)
  <span class="ruby-comment">#log_system_files(&quot;Backup: start/#{caller}&quot;) </span>
  <span class="ruby-identifier">system_files</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-node">&quot;#{Syctask::SYC_DIR}/*&quot;</span>)
  <span class="ruby-identifier">system_files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">f</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r(\.original(?:\.original)*)/</span>
      <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mv</span> <span class="ruby-identifier">f</span>, <span class="ruby-identifier">f</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;.original&quot;</span>
      <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">touch</span> <span class="ruby-identifier">f</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-comment">#Uncomment if you want to log backing up system files </span>
  <span class="ruby-comment">#log_system_files(&quot;Backup: end&quot;)</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- backup_system_files-source -->
          
        </div>

        

        
      </div><!-- backup_system_files-method -->

    
      <div id="method-i-log_system_files" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">log_system_files</span><span
            class="method-args">(message)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Logs the backup and restore of system files. Used by <a
href="Test.html#method-i-backup_system_files">#backup_system_files</a> and
<a href="Test.html#method-i-restore_system_files">#restore_system_files</a></p>
          

          
          <div class="method-source-code" id="log_system_files-source">
            <pre><span class="ruby-comment"># File test/test_helper.rb, line 49</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">log_system_files</span>(<span class="ruby-identifier">message</span>)
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">'syctask_test.log'</span>, <span class="ruby-string">'a'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{Time.now} - #{message} #{self}&quot;</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">%xls #{Syctask::SYC_DIR}`</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- log_system_files-source -->
          
        </div>

        

        
      </div><!-- log_system_files-method -->

    
      <div id="method-i-restore_system_files" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">restore_system_files</span><span
            class="method-args">(caller)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Restores the file systems after the test</p>
          

          
          <div class="method-source-code" id="restore_system_files-source">
            <pre><span class="ruby-comment"># File test/test_helper.rb, line 31</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">restore_system_files</span>(<span class="ruby-identifier">caller</span>)
  <span class="ruby-comment">#log_system_files(&quot;Restore: start/#{caller}&quot;)</span>
  <span class="ruby-identifier">originals</span> = []
  <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-node">&quot;#{Syctask::SYC_DIR}/*&quot;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">end_with?</span> <span class="ruby-string">&quot;.original&quot;</span> 
      <span class="ruby-identifier">originals</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">f</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm</span> <span class="ruby-identifier">f</span> 
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">originals</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mv</span> <span class="ruby-identifier">o</span>, 
                       <span class="ruby-identifier">o</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">%r(\.original(?:\.original)*)/</span>, <span class="ruby-string">&quot;&quot;</span>) }
  <span class="ruby-comment">#Uncomment if you want to log restoration of system files</span>
  <span class="ruby-comment">#log_system_files(&quot;Restore: end&quot;)</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- restore_system_files-source -->
          
        </div>

        

        
      </div><!-- restore_system_files-method -->

    
      <div id="method-i-units_to_time" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">units_to_time</span><span
            class="method-args">(units)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Calculates the seconds for the provided time units. One unit is 900 seconds
or 15 minutes. This time is used in Syctask#Task e.g. for the duration.
Returns the time in seconds</p>
          

          
          <div class="method-source-code" id="units_to_time-source">
            <pre><span class="ruby-comment"># File test/test_helper.rb, line 12</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">units_to_time</span>(<span class="ruby-identifier">units</span>)
  <span class="ruby-identifier">units</span> * <span class="ruby-value">15</span> * <span class="ruby-value">60</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- units_to_time-source -->
          
        </div>

        

        
      </div><!-- units_to_time-method -->

    
    </section><!-- public-instance-method-details -->
  
  </section><!-- 5Buntitled-5D -->

</div><!-- documentation -->


<footer id="validator-badges">
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>

